package pers.zb.cloud.web.upms.controller;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

@Controller
public class IndexController{

    //当前系统的 clientId
    @Value("${security.oauth2.client.client-id}")
    private String currentClientId;

    @RequestMapping("/")
    public String indexPage(Model model) {
        String userName = SecurityContextHolder.getContext().getAuthentication().getName(); //获取当前登录认证的用户名
        model.addAttribute("userName",userName);
        model.addAttribute("currentClientId",currentClientId);
    	return "index";
    }

    @RequestMapping("/home")
    public String homePage() {
        return "home";
    }
}
